package org.example.myerp.controller;

import java.util.List;

import org.example.myerp.pojo.PageMyself;
import org.example.myerp.pojo.*;import org.example.myerp.service.ProlevelService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * ��Ʒ���ο��Ʋ�
 *
 * @author DELL
 *
 */
//@CrossOrigin(methods = { RequestMethod.POST, RequestMethod.GET }, allowCredentials = "true", allowedHeaders = "*")

@RestController
@RequestMapping("/design/prolevel")
public class ProlevelController {
	@Autowired
    ProlevelService prolevelService;

	/**
	 * ��ѯȫ����Ʒ������Ϣ
	 *
	 * @return
	 */
	@RequestMapping("/getFindProlevelsAll")
	@ResponseBody
	public List<Prolevel> getFindProlevelsAll() {
		List<Prolevel> list = prolevelService.getFindProlevelsAll();
		return list;
	}

	/**
	 * �����������в�ѯȫ����Ʒ������Ϣ����ҳ��ѯ��
	 *
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	@RequestMapping("/getFindProlevelByPagerMessage")
	@ResponseBody
	public PageMyself<Prolevel> getFindProlevelByPagerMessage(Integer pageNum, Integer pageSize) {
		PageMyself<Prolevel> getFindProlevelByPagerMessage = prolevelService.findProlevelByPagerMessage((pageNum - 1) * pageSize, pageSize);
		return getFindProlevelByPagerMessage;
	}

	/**
	 * ��Ӳ�Ʒ������Ϣ
	 *
	 * @param prolevel
	 * @return
	 */
	@RequestMapping("/getInsertProlevelByNumName")
	@ResponseBody
	public Integer getInsertProlevelByNumName(Prolevel prolevel) {
		System.out.println(prolevel);
		Integer row = prolevelService.getInsertProlevelByNumName(prolevel);
		return row;
	}


	@RequestMapping("/getDeleteProlevelByNums")
	@ResponseBody
	public Integer getDeleteProlevelByNums(Integer[] levelnums) {
		Integer row = prolevelService.getDeleteProlevelByNums(levelnums);
		return row;
	}
}
